package org.example.chatservice.entity;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.time.LocalDateTime;

@Data
@Document(collection = "chat_messages")
public class ChatMessage {
    @Id
    private String id;
    private String senderId;
    private String senderName;
    private String receiverId;  // 可以是用户ID或群组ID
    private String content;
    private MessageType type;
    private LocalDateTime timestamp;
    private boolean isRead;
    private String conversationId;

    public enum MessageType {
        CHAT,
        JOIN,
        LEAVE,
        TYPING
    }
}